<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {
    
        function __construct() {
            parent::__construct();
            $this->load->model('login');
            $this->load->model('dbase');
        }
        
        function index($page = '1') {
            $sessions = $this->login->session_Check();
                
            if ($sessions == FALSE)
            {
                $this->load->model('steamopenid');
                $data_user = array();
                $data_user['logged_in'] = FALSE;
                $data_user['steam_login_link'] = $this->steamopenid->genUrl("http://acdervis.dotaiki.com/acd/?returning=1");
            } else {
                $data_user = array(
                    'logged_in' => TRUE,
                    'nickname' => $sessions['nickname'],
                    'avatar' => $sessions['avatar'],
                );
            }
            
            if($page >= 2)
            {
                $data_news['news'] = $this->dbase->get_News($page);
                
                
            } else {
                $data_news['news'] = $this->dbase->get_News(1);
            }
            
            $views = array(
                'header_menu' => $this->load->view('header', $data_user, TRUE),
                'content' => $this->load->view('content', $data_news, TRUE),
            );
            $this->parser->parse('main', $views);
        }
	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	/*public function index()
	{
		$this->load->view('welcome_message');
	}*/
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */